package com.ibeeking.found.content.cp.rest.controller.v1.feign;

import com.ibeeking.found.content.cp.rest.service.IArticleGroupService;
import com.ibeeking.found.content.cp.rest.service.IArticleService;
import com.ibeeking.found.content.service.common.query.ArticleGroupQuery;
import com.ibeeking.found.content.service.common.query.ArticleQuery;
import com.ibeeking.found.content.service.common.vo.ArticleGroupVO;
import com.ibeeking.found.content.service.common.vo.ArticleVO;
import com.ibeeking.nematos.constants.enums.OperateLogTypeEnum;
import com.ibeeking.nematos.log.annotation.Log;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName ArticleController控制器
 * @Description
 * @Author ibeeking
 * @Date 2022-02-18 14:11
 **/
@RestController
@RequestMapping("/cp/article/feign/v1")
public class ArticleFeignController {

    @Resource
    private IArticleService articleServiceImpl;
    @Resource
    private IArticleGroupService articleGroupServiceImpl;

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "文章列表")
    @PostMapping(value = "/list")
    public List<ArticleVO> list(@RequestBody ArticleQuery articleQuery) {
        return articleServiceImpl.list(articleQuery);
    }

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "文章分组列表")
    @PostMapping(value = "/group/list")
    public List<ArticleGroupVO> groupList(@RequestBody ArticleGroupQuery articleGroupQuery) {
        return articleGroupServiceImpl.list(articleGroupQuery);
    }

}
